Skip to content

Actionable hashcat error on GPU-less environments - #111

Merged
mkultraWasHere merged 4 commits into
mainfrom
feat/hashcat-cpu-fallback
Aug 3, 2026
Merged

Actionable hashcat error on GPU-less environments#111
mkultraWasHere merged 4 commits into
mainfrom
feat/hashcat-cpu-fallback

Conversation

@mkultraWasHere

Copy link
Copy Markdown
Contributor

On GPU-less VMs, hashcat exits immediately with CL_PLATFORM_NOT_FOUND_KHR and the agent gets an opaque error with no guidance on how to proceed.

Fixed

  • hashcat tool no longer returns an opaque error on environments without OpenCL/CUDA/HIP — it now tells the agent to use john_the_ripper with the correct hash_format for known modes (1000→nt, 2100→mscash2, 13100→krb5tgs, 18200→krb5asrep)

Notes

  • Non-backend hashcat failures (bad hash format, corrupted file, etc.) still propagate unchanged
  • No auto-fallback — the agent receives the error and decides to call john_the_ripper itself

…ckend

On GPU-less VMs, hashcat exits with CL_PLATFORM_NOT_FOUND_KHR and the
agent gets an opaque error. Catch this specific failure and raise with
a clear message directing the agent to use john_the_ripper instead,
including the correct hash_format for known modes.

Co-Authored-By: Claude <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the network-ops cracking tool UX on GPU-less environments by turning common hashcat “no backend” failures into actionable guidance that suggests using john_the_ripper, including mode→format hints for a few known hash types.

Changes:

  • Added hashcat-mode → john-format mapping for a small set of common modes.
  • Intercepted hashcat failures that look like missing OpenCL/CUDA/HIP backends and raised a clearer, actionable error message.
  • Minor formatting adjustments for readability of some execute(...) calls.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread capabilities/network-ops/tools/cracking.py
Comment thread capabilities/network-ops/tools/cracking.py Outdated
mkultraWasHere and others added 2 commits August 2, 2026 19:50
…john under hashcat variant

Add three tests covering backend-marker detection (known mode, unknown
mode, non-backend error propagation). Register john_the_ripper under
the hashcat variant so the fallback suggestion is actionable.

Co-Authored-By: Claude <noreply@anthropic.com>
Drop the unknown-mode test (just a dict miss) and add a test verifying
the original hashcat error is preserved as __cause__ on the re-raised
RuntimeError.

Co-Authored-By: Claude <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Suppressed comments (2)

capabilities/network-ops/tests/test_tool_fixes.py:616

  • PR description mentions an “unknown mode” test case for the no-backend branch, but the current tests don’t cover the hashcat_mode path where no john format mapping exists (the HASHCAT_TO_JOHN.get() miss). Add a test that asserts the error message includes the “no automatic john format mapping” guidance when hashcat_mode is unmapped.
    @pytest.mark.asyncio

capabilities/network-ops/tools/cracking.py:93

  • The broad except Exception can intercept task cancellation (e.g., asyncio.CancelledError) and potentially re-wrap it as a backend-missing RuntimeError, which can break cooperative cancellation/timeouts. Re-raise cancellations explicitly before the generic handler.
            except Exception as e:

@mkultraWasHere mkultraWasHere left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed suppressed Copilot comments:

  1. Unmapped mode test — Refuted. Deliberately removed in 3219f54 as low-value (tests a dict lookup miss). PR description is stale from the earlier commit.

  2. except Exception catching CancelledError — Refuted. asyncio.CancelledError is a BaseException in Python 3.9+ and won't be caught. The bare raise at line 107 re-raises anything that doesn't match backend markers.

Co-Authored-By: Claude <noreply@anthropic.com>
@mkultraWasHere
mkultraWasHere merged commit 8309ed1 into main Aug 3, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants